import axios from 'axios'
// import NProgress from 'nprogress'
// import store from '@/store'
import store from '@/store'
import { Loading } from 'element-ui'
const request = axios.create({
  baseURL: 'https://www.liulongbin.top:8888/api/private/v1/'
})
let loadingInstance
// axios 请求拦截器
request.interceptors.request.use(config => {
  // console.log(config)
  if (store.state.user) {
    config.headers.Authorization = store.state.user
  }
  loadingInstance = Loading.service()
  return config
})

request.interceptors.response.use(res => {
  loadingInstance.close()
  return res
})
export default request
